Move the drop feedback code to stub functions
authorFederico Mena Quintero <federico@gnome.org>
Fri, 19 Apr 2013 16:25:03 +0000 (11:25 -0500)
committerFederico Mena Quintero <federico@gnome.org>
Fri, 19 Apr 2013 16:30:23 +0000 (11:30 -0500)
For now it is the old, simple call to gtk_tree_view_set_drag_dest_row().  We'll do something
fancier in the following commits.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
gtk/gtkplacessidebar.c

index f66b7c05d85b5f6b1fad451cb36e48f0da3a3d3e..1e47848a3dea8899c4b98b4d67addcda78d8d867 100644 (file)
@@ -1408,6 +1408,18 @@ free_drag_data (GtkPlacesSidebar *sidebar)
        }
 }
 
+static void
+start_drop_feedback (GtkPlacesSidebar *sidebar, GtkTreePath *path, GtkTreeViewDropPosition pos, gboolean drop_as_bookmarks)
+{
+       gtk_tree_view_set_drag_dest_row (sidebar->tree_view, path, pos);
+}
+
+static void
+stop_drop_feedback (GtkPlacesSidebar *sidebar)
+{
+       gtk_tree_view_set_drag_dest_row (sidebar->tree_view, NULL, 0);
+}
+
 static gboolean
 drag_motion_callback (GtkTreeView *tree_view,
                      GdkDragContext *context,
@@ -1421,8 +1433,10 @@ drag_motion_callback (GtkTreeView *tree_view,
        int action;
        GtkTreeIter iter;
        gboolean res;
+       gboolean drop_as_bookmarks;
 
        action = 0;
+       drop_as_bookmarks = FALSE;
 
        if (!sidebar->drag_data_received) {
                if (!get_drag_data (tree_view, context, time)) {
@@ -1449,7 +1463,6 @@ drag_motion_callback (GtkTreeView *tree_view,
                if (sidebar->drag_list != NULL) {
                        SectionType section_type;
                        PlaceType place_type;
-                       gboolean drop_as_bookmarks;
 
                        gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar->store),
                                                 &iter, path);
@@ -1459,8 +1472,6 @@ drag_motion_callback (GtkTreeView *tree_view,
                                            PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type,
                                            -1);
 
-                       drop_as_bookmarks = FALSE;
-
                        if (section_type == SECTION_BOOKMARKS) {
                                if (pos == GTK_TREE_VIEW_DROP_BEFORE || pos == GTK_TREE_VIEW_DROP_AFTER) {
                                        action = GDK_ACTION_COPY;
@@ -1490,9 +1501,9 @@ drag_motion_callback (GtkTreeView *tree_view,
 
  out:
        if (action != 0)
-               gtk_tree_view_set_drag_dest_row (tree_view, path, pos);
+               start_drop_feedback (sidebar, path, pos, drop_as_bookmarks);
        else
-               gtk_tree_view_set_drag_dest_row (tree_view, NULL, pos);
+               stop_drop_feedback (sidebar);
 
        if (path != NULL) {
                gtk_tree_path_free (path);